﻿@using ST = EmoneyWeiXinCommon.StringTools
@{
    ViewBag.Title = "益盟操盘手-微信统一管理平台-登录";
    Layout = null;
}

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link href="@ST.GetStaticFile("Models/css/basic.css")" rel="stylesheet" type="text/css">
    <title>登陆</title>
    <script type="text/javascript" src="@ST.GetStaticFile("Scripts/jquery-1.8.3.min.js")"></script>
</head>
<body>
    <header class="header">
        <div class="header_p">
            <img src="@ST.GetStaticFile("Models/images/logo.png")" title="益盟操盘手-微信统一管理平台">
        </div>
    </header>
    <div class="register">
        <p>
            <img src="@ST.GetStaticFile("Models/images/register_bg.jpg")">
        </p>
        <div class="register_box_bg">
            <div class="register_box_content">
                <h3>用户登陆</h3>
                <ul>
                    <li><span>用户账号：</span><input id="txtUserName" type="text" value="请输入用户名" onblur="if(this.value==''){this.value='请输入用户名';}" onfocus="if(this.value=='请输入用户名'){this.value='';}"></li>
                    <li><span>登录密码：</span><input id="txtUserPwd" type="password" value="请输入密码" onblur="if(this.value==''){this.value='请输入密码';}" onfocus="if(this.value=='请输入密码'){this.value='';}"></li>
                    <li>
                        <input type="checkbox"><i>记住用户账号</i><i>忘记密码？</i></li>
                    <li>
                        <div id="btnLogin"><a href="javascript:void(0);">登 录</a></div>
                    </li>
                </ul>
            </div>
            <p class="register_font">当前系统仅支持通过认证的微信服务号</p>
        </div>
    </div>
    <footer class="footer">
        <p>版权所有：上海益盟软件技术股份有限公司  移动获客小组提供技术支持</p>
        <p>服务电话：<span class="red">021-61957469</span></p>
        <p>沪ICP备06000340 </p>
    </footer>
</body>
</html>

<script type="text/javascript">
    $(window).ready(function () {
        $("#btnLogin").click(function () {
            if ($("#txtUserName").val() == "" || $("#txtUserName").val() == "请输入用户名") {
                alert("用户名不能为空");
                $("#txtUserName").focus();
                return false;
            }

            if ($("#txtUserPwd").val() == "" || $("#txtUserPwd").val() == "请输入密码") {
                alert("密码不能为空");
                $("#txtUserPwd").focus();
                return false;
            }

            $.ajax({
                type: "post",
                url: "@ST.GetTrendsFile("Account/RegisterUser")",
                async: true,
                data: { txtUserName: encodeURIComponent($("#txtUserName").val()), txtUserPwd: encodeURIComponent($("#txtUserPwd").val()) },
                dataType: "html",
                success: function (result) {
                    if (parseInt(result) > 0) {
                        location.href = "@ST.GetTrendsFile("Account/Index")";
                    }
                    else if (result == "0") {
                        alert("用户名或密码错误");
                    }
                    else if (result == "-1") {
                        alert("用户名不能为空");
                    }
                    else if (result == "-2") {
                        alert("密码不能为空");
                    }
                    else if (result == "-3") {
                        alert("用户名或密码中不能含有特殊字符");
                    }
                    else {
                        alert(result);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("error");
                }
            });
        })
    });
</script>

